package nowcoder.huawei;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.Scanner;

/**
 * @author wuguojian
 * @description
 * @date 2023/4/12 下午9:46
 * https://www.nowcoder.com/practice/119bcca3befb405fbe58abe9c532eb29
 **/
public class HJ17 {
    public static void main(String[] args) throws FileNotFoundException {
        Scanner in = new Scanner(new FileReader("input/nowcoder_huawei/HJ17.txt"));
//        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            int x = 0, y = 0;
            String s = in.nextLine();
            String[] cmds = s.split(";");
            for (int i = 0; i < cmds.length; i++) {
                if(cmds[i].length() < 2){
                    continue;
                }
                String c = cmds[i].substring(0, 1);
                int step = 0;
                try {
                    step = Integer.parseInt(cmds[i].substring(1));
                }catch (Exception e){

                }
                if("A".equals(c)){
                    x -= step;
                }
                if("D".equals(c)){
                    x += step;
                }
                if("S".equals(c)){
                    y -= step;
                }
                if("W".equals(c)){
                    y += step;
                }
            }
            System.out.println(x + "," + y);
        }
    }
}
